#include <QtGui/QApplication>
#include <QtGui/QVBoxLayout>
#include <QtGui/QLabel>
#include <QtGui/QSpinBox>
#include <QtGui/QSlider>
int main(int argc, char* argv[])
{
   QApplication app(argc,argv);
   QWidget window;
   QVBoxLayout *mainLayout =new QVBoxLayout(&window);
   QLabel *label = new QLabel("0");
   QSpinBox *spinBox = new QSpinBox;
   QSlider *slider = new QSlider(Qt::Horizontal);
   mainLayout->addWidget(label);
   mainLayout->addWidget(spinBox);
   mainLayout->addWidget(slider);

   window.show();
   QObject::connect(spinBox, SIGNAL(valueChanged(int)), label, SLOT(setNum(int)));
   QObject::connect(spinBox, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));
   QObject::connect(slider, SIGNAL(valueChanged(int)), label, SLOT(setNum(int)));
   QObject::connect(slider, SIGNAL(valueChanged(int)), spinBox, SLOT(setValue(int)));

   return app.exec();
}